/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.tom.social.dal.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Tom
 */
@Entity
@Table(name = "GraphMeasure")
@NamedQueries({@NamedQuery(name = "GraphMeasure.findAll", query = "SELECT g FROM GraphMeasure g"),
	@NamedQuery(name = "GraphMeasure.findByType", query = "SELECT g FROM GraphMeasure g WHERE g.type = :type")})
public class GraphMeasure implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Basic(optional = false)
	@Column(name = "id")
	private Integer id;
	@Basic(optional = false)
	@Column(name = "type")
	private int type;
	@Basic(optional = false)
	@Column(name = "score")
	private double score;
	@JoinColumn(name = "analysis_id", referencedColumnName = "id")
	@ManyToOne(optional = false, fetch = FetchType.LAZY)
	private Analysis analysisId;

	public GraphMeasure() {
	}

	public GraphMeasure(Integer id) {
		this.id = id;
	}

	public GraphMeasure(Integer id, int type, double score) {
		this.id = id;
		this.type = type;
		this.score = score;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public double getScore() {
		return score;
	}

	public void setScore(double score) {
		this.score = score;
	}

	public Analysis getAnalysisId() {
		return analysisId;
	}

	public void setAnalysisId(Analysis analysisId) {
		this.analysisId = analysisId;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (id != null ? id.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		if(!(object instanceof GraphMeasure)) {
			return false;
		}
		GraphMeasure other = (GraphMeasure) object;
		if((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "pl.tom.social.dal.entity.GraphMeasure[id=" + id + "]";
	}

}
